**********************************************************************************************
set more off

log using table2.log, replace text

/*
*instructions for outreg;
local instruct_ols "ctitle(OLS) tdec(2) rdec(2) auto(2) symbol(***,**,*) se"; 
local instruct_iv "ctitle(IV) tdec(2) rdec(2) auto(2) symbol(***,**,*) se addstat(First stage F, e(widstat))"; 
local instruct_iv_overid "ctitle(IV) tdec(2) rdec(2) auto(2) symbol(***,**,*)  se addstat(Overid,e(jp),First stage F, e(widstat))"; 
*/

********************************************************************; 
***     TABLE 2
********************************************************************; 

*First stage regressions

reg all_road_2010_rays road_1962_rays rail_1962_rays po_s_road_1962_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref ruralMigp00 if D0==1,  robust cluster(province05)
outreg2 using "table2", word excel symbol(***,**,*) se replace

reg all_road_1999_rays road_1962_rays rail_1962_rays po_s_road_1962_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref ruralMigp00 if D0==1,  robust cluster(province05)
outreg2 using "table2", word excel symbol(***,**,*)  se append

reg all_road_2005_rays road_1962_rays rail_1962_rays po_s_road_1962_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref ruralMigp00 if D0==1,  robust cluster(province05)
*outreg2 using "table2", word excel symbol(***,**,*)  se append

reg rail_2010_rays road_1962_rays rail_1962_rays po_s_road_1962_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref ruralMigp00 if D0==1,  robust cluster(province05)
outreg2 using "table2", word excel symbol(***,**,*)  se append

reg po_s_all_road_2010_ringxda road_1962_rays rail_1962_rays po_s_road_1962_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref ruralMigp00 if D0==1,  robust cluster(province05)
outreg2 using "table2", word excel symbol(***,**,*)  se append

reg D_censuspop9010_pref road_1962_rays rail_1962_rays po_s_road_1962_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref ruralMigp00 if D0==1,  robust cluster(province05)
outreg2 using "table2", word excel symbol(***,**,*)  se append


******* End of Section 4.2: Do for difference in highways 1999-2010 *******

gen Dray = all_road_2010_rays-all_road_1999_rays
reg Dray larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays po_s_road_1962_ringxda  if D0==1,  robust cluster(province05)

**** Do by CP1990 Terciles
egen tercile1 = pctile(lcensuspop1990_cp) if D0==1, p(33)
egen tercile2 = pctile(lcensuspop1990_cp) if D0==1, p(66)

*Tercile 1
reg all_road_2010_rays         larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp<=tercile1,  robust cluster(province05)
reg all_road_1999_rays         larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp<=tercile1,  robust cluster(province05)
reg rail_2010_rays             larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp<=tercile1,  robust cluster(province05)
reg po_s_all_road_2010_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp<=tercile1, robust cluster(province05)
*Tercile 2
reg all_road_2010_rays         larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp>tercile1 & lcensuspop1990_cp<=tercile2, robust cluster(province05)
reg all_road_1999_rays         larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp>tercile1 & lcensuspop1990_cp<=tercile2, robust cluster(province05)
reg rail_2010_rays             larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp>tercile1 & lcensuspop1990_cp<=tercile2, robust cluster(province05)
reg po_s_all_road_2010_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp>tercile1 & lcensuspop1990_cp<=tercile2, robust cluster(province05)
*Tercile 3
reg all_road_2010_rays         larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp>tercile2,  robust cluster(province05)
reg all_road_1999_rays         larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp>tercile2,  robust cluster(province05)
reg rail_2010_rays             larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp>tercile2,  robust cluster(province05)
reg po_s_all_road_2010_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & lcensuspop1990_cp>tercile2, robust cluster(province05)

*East
reg all_road_2010_rays larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & east==1,  robust cluster(province05)
reg all_road_1999_rays larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & east==1,  robust cluster(province05)
reg rail_2010_rays larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & east==1,  robust cluster(province05)
reg po_s_all_road_2010_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & east==1, robust cluster(province05)
*Center/West
reg all_road_2010_rays larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & east==0,  robust cluster(province05)
reg all_road_1999_rays larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & east==0,  robust cluster(province05)
reg rail_2010_rays larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & east==0,  robust cluster(province05)
reg po_s_all_road_2010_ringxda larea_cc90 larea_pf05 province_capitalPlus lcensuspop1982_pref frac_highedu1982_pref share_emp_man1982_pref road_1962_rays rail_1962_rays  po_s_road_1962_ringxda ruralMigp00 if D0==1 & east==0, robust cluster(province05)

log close

